package me.xiaoyan.java.chapter14;

/**
 * 人类
 * @author keley
 *
 */
public class Person {
	/**
	 * 名字
	 */
	String name;
	
	
	int[] moneys = {1,5,10,20,50,100};
	
	
	//睡觉
	public void sleep(){
		System.out.println(name + "在睡觉");
	}
	
	/**
	 * 吃饭
	 */
	public void eat(String foodName,boolean isHungry){
		if(isHungry){
			System.out.println(name + "在吃" + foodName);
		}else{
			System.out.println("还没有饿");
		}
	}
	
	/**
	 * 找钱
	 * @return
	 */
	public boolean searchMoney(int money,int start,int end){
		if(start >= 0 && end <= moneys.length)
		{//判断参数是否合法
			for(int i = start;i < end;i++){
				if(moneys[i] == money){
					return true;
				}
			}
		}
		return false;
	}
	
	
	
	
}
